package com.ctg.payroll2.dao.workflow;

import java.sql.SQLException;
import java.util.List;

import com.ctg.payroll2.bean.ComboData;
import com.ctg.payroll2.bean.filter.WorkflowTaskFilter;
import com.ctg.payroll2.bean.po.PayClass;
import com.ctg.payroll2.bean.po.workflow.FlowInstance;
import com.ctg.payroll2.bean.po.workflow.FlowMaster;
import com.ctg.payroll2.bean.po.workflow.FlowOrgchart;
import com.ctg.payroll2.bean.po.workflow.FlowPayData;
import com.ctg.payroll2.bean.po.workflow.FlowRuninfo;
import com.ctg.payroll2.bean.po.workflow.FlowRunnext;
import com.ctg.payroll2.bean.po.workflow.FlowStep;
import com.ctg.payroll2.bean.po.workflow.FlowStepRun;
import com.ctg.platform.util.Page;

public interface WorkflowTaskDao {
	Page queryTask(WorkflowTaskFilter filter);
	/**
	 * 插入一条流程实例
	 * @param flowInstance 流程实例
	 * @return 主键
	 * @throws SQLException sql异常
	 */
	public Long insertFlowInstance(FlowInstance flowInstance) throws SQLException;
	/**
	 * 插入一条流程执行
	 * @param flowRunnext 流程执行
	 * @return 主键
	 * @throws SQLException sql异常
	 */
	public Long insertFlowRunnext(FlowRunnext flowRunnext) throws SQLException;
	/**
	 * 插入一条流程审核记录
	 * @param flowRunnext 流程审核记录
	 * @return 主键
	 * @throws SQLException sql异常
	 */
	public Long insertFlowRuninfo(FlowRuninfo flowRuninfo) throws SQLException;
	/**
	 * 更新一条流程实例
	 * @param flowInstance 流程实例
	 * @return 影响的记录数
	 * @throws SQLException sql异常
	 */
	public int updateFlowInstance(FlowInstance flowInstance) throws SQLException;
	/**
	 * 更新一条流程执行
	 * @param flowRunnext 流程执行
	 * @return 影响的记录数
	 * @throws SQLException sql异常
	 */
	public int updateFlowRunnext(FlowRunnext flowRunnext) throws SQLException;
	/**
	 * 子公司个数
	 * @param flowRunnext 流程执行
	 * @return 影响的记录数
	 * @throws SQLException sql异常
	 */
	public Integer querySubCompanyCount(WorkflowTaskFilter filter) throws SQLException;
	/**
	 * 步骤执行人
	 * @param flowRunnext 流程执行
	 * @return 账号或者角色
	 * @throws SQLException sql异常
	 */
	public FlowStepRun queryStartFlowStepRun(WorkflowTaskFilter filter) throws SQLException;
	/**
	 * 步骤执行人
	 * @param flowRunnext 流程执行
	 * @return 账号或者角色
	 * @throws SQLException sql异常
	 */
	public FlowStepRun queryFlowStepRun(WorkflowTaskFilter filter) throws SQLException;
	/**
	 * 查询下辖公司列表
	 * @param filter 带company_code的查询条件
	 * @return 下辖公司列表
	 * @throws SQLException sql异常
	 */
	List<ComboData> querySubordinateByCompanyCode(WorkflowTaskFilter filter) throws SQLException;
	/**
	 * 查询公司的所有员工数
	 * @param filter 公司code
	 * @return 员工数
	 * @throws SQLException sql异常
	 */
	int getEmployeeCountOfCompany(WorkflowTaskFilter filter)throws SQLException;
	/**
	 * 查询薪资发放记录中的员工数
	 * @param filter 查询条件
	 * @return 薪资发放记录中的员工数
	 * @throws SQLException sql异常
	 */
	int getEmployeeCountOfPayData(WorkflowTaskFilter filter)throws SQLException;
	/**
	 * 查询发放记录
	 * @param filter 查询条件
	 * @return 发放记录list
	 * @throws SQLException sql异常
	 */
	int queryPayLogByPeriod(WorkflowTaskFilter filter)throws SQLException;
	/**
	 * 查询薪资类别
	 * @param filter 条件
	 * @return 薪资类别
	 * @throws SQLException sql异常
	 */
	List<ComboData> queryPayTypeByFilter(WorkflowTaskFilter filter)throws SQLException;
	public FlowMaster queryFlowMaster(WorkflowTaskFilter filter)throws SQLException;
	public FlowStep queryStartFlowStep(WorkflowTaskFilter filter)throws SQLException;
	public FlowStep queryNextFlowStep(WorkflowTaskFilter filter)throws SQLException;
	/**
	 * 根据实例id得到审核意见,以回车分隔
	 * @param id 实例id
	 * @return 审核意见
	 * @throws SQLException sql异常
	 */
	String queryApproveMemoByIsId(Long id)throws SQLException;
	public FlowRunnext queryFlowRunnext(WorkflowTaskFilter filter)throws SQLException;
	public FlowOrgchart queryParentFlowOrgchat(WorkflowTaskFilter filter)throws SQLException;
	public FlowInstance queryFlowInstance(WorkflowTaskFilter filter)throws SQLException;
	public Integer querySubInstance_count(WorkflowTaskFilter filter)throws SQLException;
	public FlowRunnext queryParentRunnext(WorkflowTaskFilter filter)throws SQLException;
	public int updatePayData(WorkflowTaskFilter filter) throws SQLException;
	public List<PayClass> queryPayClassIdFromPayData(WorkflowTaskFilter filter)throws SQLException;
	public List<FlowPayData> queryAreaFromPayData(WorkflowTaskFilter filter)throws SQLException;
	public List<FlowPayData> queryGroupFromPayData(WorkflowTaskFilter filter)throws SQLException;
	public List<FlowPayData> querySubCompany(WorkflowTaskFilter filter)throws SQLException;
}
